<template>
<view class="mains u-flex">
		<view class="text">
			<u-search placeholder="请输入微信昵称"   v-model="who"  @click="showimg=false" @change="getname()" 
			:show-action="false"
			></u-search>
		</view>
		<view class="box" v-if="getnames">
			<view v-for="item in lists" :key="item.id" class="box0">
				<view class="items u-flex">
					<view class="left">
						<image :src="item.wx_total" mode=""></image>
					</view>
					<view class="center">
						<h3>{{item.wx_nick_name}}</h3>
						<p>微信号：{{item.id}}</p>
					</view>
					<view class="end"  @click="getid(item.id,item.wx_nick_name,item.wx_total)">
						添加
					</view>
				</view>
			</view>
		</view>
		<view>
			<!-- <u-mask :show="bigshow" @click="bigshow = false">
				<view class="warp">
					<view class="rect" @tap.stop>
						<view class="succes">
							<view class="center">
							</view>
							<view class="addsucces">
								添加成功
							</view>
							<view class="wanshan" @click="fasong()">
								完善客户信息>>
							</view>
						</view>
					</view>
				</view>
			</u-mask> -->
		</view>
		<view v-if="showimg">
			<QRCode></QRCode>
		</view>
	</view>
</template>

<script>
	import QRCode from "../../component/QRCode.vue"
	export default {
		components: {
		QRCode
		},
		data() {
			return {
				showimg:true,
				mycodeimg:"",
				getnames:false,
				agent_id:"",
				nickName:"",
				lists:[],
				list:[],
				avatarUrl:"",
				token: "",
				who:"",
				is: false,
				show: false,
			}
		},
		methods: {
			likai() {
				console.log("离开")
			},
			getid(id,name,img){
				console.log("这个东西的id是")
				wx.setStorage({
				  key:"goodsit",
				  data:{
					  id:id,
					  name:name,
					  img:img,
				  },
				})
				this.fasong()
				
			},
			bianle(){
			console.log("数据发生了变化")
			},
			fasong(){
				// this.bigshow=true
				console.log("发送的列表")
				console.log("存储成功")
				// var that=this
				wx.navigateTo({
					url:"../user/wanshan"
				})
			},
			change(){
				this.is = true
				console.log("调用change")
			},
			changebig(){
				this.bigshow=true
				console.log("bigshow改了")
			},
			getname(){
				this.showimg=false
				this.getnames=true
				console.log(this.getnames);
				console.log("调用了方法")
				var that=this
				// let arr=[]
				console.log(that.who)
					this.$flyio.get('v1.Customer/selectWxUser', {
						name:that.who					}).then((ret) => {
						that.lists=ret.data
						console.log("搜索的返回");
						console.log(ret)					})					.catch((e) => {						console.log(e)					})
					
			},
			getyonghuid(){
				var nickName=wx.getStorageSync("nickName")
				var agent_id=wx.getStorageSync("agent_id")
				this.nickName=nickName
				this.agent_id=agent_id
				console.log("获取了自己的id"+nickName)
			}
		},
		onLoad() {
			
			// this.getcodeimg()
			var that=this
			wx.showLoading({
				  title: '加载中',
				  success(){
					 that.getyonghuid();
				  }
				})
			setTimeout(function () {
			  wx.hideLoading()
			}, 1000)
		}
	}
</script>

<style scoped lang="scss">
	.box{
		height: 100%;
		width: 100%;
		margin-top: 50upx;
		.box0{
			
			.items{
				justify-content: space-between;
				.left{
					height: 80upx;
					width: 80upx;
					// background-color:red;
				}
				width: 100%;
				padding: 50upx;
				// border: 1px solid red;
				height: 80upx;
				image{
					height: 80upx;
					width: 80upx;
					border-radius: 50%;
				}
				.center{
					text-align: left;
					// background-color: green;
					flex: 1;
					padding-left: 20upx;
				}
				.end{
					border: 1upx solid #ff6666;
					text-align: center;
					width: 140upx;
					height: 50rpx;
					color: #ff6666;
					justify-self: end;
					line-height: 50rpx;
					border-radius: 4upx;
				}
			}
		}
		// border: 1px solid red;
		
	}
	
	
	
	
	.warp {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;
	}
	
	.rect {
		width: 546upx;
		height: 563upx;
		background-color: $f;
	}
	navigator {
		border-bottom: 3px solid #3399ff;
	}
	.text{
		margin-top: 59upx;
		width: 100%;
		padding-left: 43upx;
		padding-right: 43upx;
	}
	.mains{
		flex-direction: column;
		height: 100%;
	}
	.box {
		width: 750upx;
		flex: 1;
		// background-color: green;
	}

	h3 {
		font-size: 30upx;
	}

	p {
		font-size: 20upx;
		color: #999999;
	}
	.succes {
		position: relative;
		text-align: center;
		width: 546upx;
		height: 563upx;

		// border: 1px solid red;
		// justify-content: space-around;
		.center {
			height: 121upx;
			width: 121upx;
			border-radius: 50%;
			position: absolute;
			left: 50%;
			top: 125upx;
			background-image: url(http://pdd.xuhuinet.com/upload/icons/chenggong.png);
			// background-color: green;
			background-repeat: no-repeat;
			background-size: 100%;
			transform: translateX(-50%);
		}

		.addsucces {
			// border-bottom: 1px solid red;
			font-size: 36upx;
			color: #339900;
			position: absolute;
			left: 50%;
			// background-color: green;
			transform: translateX(-50%);
			bottom: 248upx;
		}

		.wanshan {
			color: #3399cc;
			// background-color: green;

			font-size: 26upx;
			position: absolute;
			transform: translateX(-50%);
			left: 50%;
			bottom: 88upx;
			height: 30upx;
		}
	}

	.dianji {
		margin-top: 50%;
		margin-bottom: 50%;
		transform: translateY(-50%);
		margin-left: 92upx;
		margin-right: 92upx;
		text-align: center;
		width: 546upx;
		height: 563upx;
		overflow: hidden;

	}
</style>
